package edu.tgc.web.controller.hrm;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import edu.tgc.entity.file.FilePath;
import edu.tgc.entity.hrm.HrmCertificate;
import edu.tgc.service.hrm.HrmCertificateService;
import edu.tgc.web.controller.file.AbstractFileResourceController;
import edu.tgc.web.form.hrm.HrmCertificateForm;

@Controller
@RequestMapping(value = "hrm/certificate")
public class HrmCertificateController extends AbstractFileResourceController<HrmCertificate, UUID, HrmCertificateForm> {

    @Autowired
	private HrmCertificateService service;
	
	@RequestMapping("/zjsCombo")
	@ResponseBody
	public Object getZjsCombo(){
		List<HashMap<String, Object>> tree=new ArrayList<>();
		List<HrmCertificate> list=service.findzjs();
		for (HrmCertificate certificate : list) {
			HashMap<String, Object> node=new HashMap<>();
			node.put("id", certificate.getUser().getCade().getName());
			node.put("text", certificate.getUser().getCade().getName());
			tree.add(node);
		}
		return tree;
	}

    @Override
    public FilePath getPath() {
        return new FilePath("d:\\file\\certificate");
    }

}
